<form id="add-form" class="form-horizontal form-ajax" role="form" data-toggle="validator" method="POST" action="">
    <input type="hidden" name="id" value="{$row.id}">
    <div class="form-group">
        <label for="title" class="control-label col-xs-12 col-sm-2"><i class="text-muted">*</i>商品标题:</label>
        <div class="col-xs-12 col-sm-8">
            <input type="text" class="form-control" id="title" name="row[title]" value="{$row.title}" data-rule="required" />
        </div>
    </div>
    <div class="form-group">
        <label for="ads" class="control-label col-xs-12 col-sm-2"><i class="text-muted">*</i>广告语:</label>
        <div class="col-xs-12 col-sm-8">
            <input type="text" class="form-control" id="ads" name="row[ads]" value="{$row.ads}" data-rule="required" />
        </div>
    </div>
    <div class="form-group">
        <label for="point" class="control-label col-xs-12 col-sm-2"><i class="text-muted">*</i>所需积分:</label>
        <div class="col-xs-12 col-sm-8">
            <input type="text" class="form-control" id="point" name="row[point]" value="{$row.point}" data-rule="required" />
        </div>
    </div>
    <div class="form-group">
        <label for="stock" class="control-label col-xs-12 col-sm-2"><i class="text-muted">*</i>库存:</label>
        <div class="col-xs-12 col-sm-8">
            <input type="text" class="form-control" id="stock" name="row[stock]" value="{$row.stock}" data-rule="required" />
        </div>
    </div>
    <div class="form-group">
        <label for="content" class="control-label col-xs-12 col-sm-2">类型:</label>
        <div class="col-xs-12 col-sm-8">
            {:build_radios('row[type]', ['1'=>'虚拟', '0'=>'实物'],$row['type'])}
        </div>
    </div>


    <div class="form-group" id="goods_stock_box">
        <label for="content" class="control-label col-xs-12 col-sm-2">卡密批次:</label>
        <div class="col-xs-12 col-sm-8">
            <input type="text" data-multiple="false" data-source="{:url('/goods/admin.goods_stock/selectpage')}" data-search-field="title" data-show-field="title" data-select-to-close-list="false" class="form-control selectpage" data-auto_fill_result="false" data-auto-select-first="false" name="row[stock_id]" value="{$row['stock_id'] ? $row['stock_id'] : ''}" placeholder="关联卡密批次">
        </div>
    </div>


    <div class="form-group">
        <label for="attrs" class="control-label col-xs-12 col-sm-2">属性:</label>
        <div class="col-xs-12 col-sm-8">
            <!--<input type="text" class="form-control" id="attrs" name="row[attrs]" value="{$row.attrs}" />-->
            <dl class="fieldlist" rel="{$row.attrs|count}" data-name="row[attrs]">
                <dd>
                    <ins>属性名</ins>
                    <ins>属性值</ins>
                </dd>

                {foreach $row.attrs as $key => $vo}
                <dd class="form-inline">
                    <input type="text" name="row[attrs][field][{$key}]" class="form-control" value="{$vo.key}" size="10" />
                    <input type="text" name="row[attrs][value][{$key}]" class="form-control" value="{$vo.val}" size="40" />
                    <span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span>
                    <span class="btn btn-sm btn-primary btn-dragsort"><i class="fa fa-arrows"></i></span>
                </dd>
                {/foreach}
                <dd><a href="javascript:;" class="append btn btn-sm btn-success"><i class="fa fa-plus"></i> {:__('Append')}</a></dd>
            </dl>
        </div>
    </div>
    <div class="form-group">
        <label for="c-album" class="control-label col-xs-12 col-sm-2"><i class="text-muted"></i>商品图册:</label>
        <div class="col-xs-12 col-sm-8">
            <button id="upload_album" type="button" class="btn btn-primary plupload" data-after-upload="changeimg" data-input-id="c-album" data-url="{:url('/attachment/attachment/upload',['folder'=>'goods'])}" data-multiple="true" data-preview-id="preview-album"><i class="fa fa-upload"></i> 上传图片</button>
            <div id="preview-album"></div>
            <input type="hidden" name="row[album]" id="c-album" value="{$row[album] ? implode(',', $row['album']) : ''}" class="form-control" />
        </div>
    </div>
    <div class="form-group">
        <label for="content" class="control-label col-xs-12 col-sm-2">内容:</label>
        <div class="col-xs-12 col-sm-8">
            <textarea class="form-control summernote" id="content" name="row[content]">{$row.content}</textarea>
        </div>
    </div>
    <div class="form-group">
        <label for="content" class="control-label col-xs-12 col-sm-2">客户经理是否可兑换:</label>
        <div class="col-xs-12 col-sm-8">
            {:build_radios('row[use_customer]', ['1'=>'可以', '0'=>'不可以'],$row['use_customer'])}
        </div>
    </div>
    <div class="form-group">
        <label for="sort" class="control-label col-xs-12 col-sm-2"><i class="text-muted">*</i>排序:</label>
        <div class="col-xs-12 col-sm-8">
            <input type="text" class="form-control" id="sort" name="row[sort]" value="{$row.sort}" />
        </div>
    </div>
    <div class="form-group">
        <label for="content" class="control-label col-xs-12 col-sm-2">状态:</label>
        <div class="col-xs-12 col-sm-8">
            {:build_radios('row[status]', ['1'=>'正常', '0'=>'下架'],$row['status'])}
        </div>
    </div>
    <div class="form-group hidden layer-footer">
        <div class="col-xs-2"></div>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>
